<?php
class PNProvinceArray extends PNObjectExArray {
  function PNProvinceArray($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'votethailandpoll_province';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';

    $this->_init($init, $where);
  }

  function genSort(){

    return " ORDER BY pro_id ASC";
    //return " ORDER BY pro_longitude DESC";
  }

  function genFilter(){
    $pid  = FormUtil::getPassedValue ('pid', null, 'GET');
    $list  = FormUtil::getPassedValue ('list', null , 'GET');
    
    $wheres = array();
    if(isset($list)){
      $wheres[] = " pro_id IN (".$list.")";
      
    }else{
      if ($pid && intval($pid)) $wheres[] = " pro_id = ".$pid;
    }
    
    

    return implode(' AND ', $wheres);
  }
  
  
}
